﻿using RestSharp;
using Ymatou.ServiceCenter;
using YmtAuth.AppService;
using YmtAuth.Dto;
using YmtSystem.CrossCutting;
using ResetService = ServiceStack.Service;

namespace YmtAuth.Web.Handlerv2
{

    public class SecurityQuestionHandler : ResetService
    {
        private ISecurityQuestionAppService SecurityQuestionAppService { get { return LocalServiceLocator.GetService<ISecurityQuestionAppService>(); } }

        /// <summary>
        /// 获取问题列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [ServiceRegister("/json/reply/GetSecurityQuestionListDto", Method.GET)]
        public object Get(GetSecurityQuestionListDto request)
        {
            return SecurityQuestionAppService.GetSecurityQuestionList();
        }

        /// <summary>
        /// 设置安全问题
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [ServiceRegister("/json/reply/SetSecurityQuestionRequestDto", Method.POST)]
        public object Post(SetSecurityQuestionRequestDto request)
        {
            return SecurityQuestionAppService.SetSecurityQuestion(request);
        }

        /// <summary>
        /// 获取已设置的安全问题（单个，验证）
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [ServiceRegister("/json/reply/GetSecurityQuestionRequestDto", Method.POST)]
        public object Get(GetSecurityQuestionRequestDto request)
        {
            return SecurityQuestionAppService.GetSecurityQuestion(request);
        }

        /// <summary>
        /// 验证安全问题
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [ServiceRegister("/json/reply/VerifySecurityQuestionRequestDto", Method.POST)]
        public object Post(VerifySecurityQuestionRequestDto request)
        {
            return SecurityQuestionAppService.VerifySecurityQuestion(request);
        }
    }
}